#include<stdio.h>
int main()
{
    int x,y;
    int day=0;
    int s;
    int max = 0;
    for(int i=1;i<8;i++)
    {
        scanf("%d%d",&x,&y);
        s = x+y;
        if(s>8&&s>max)
        {
            max = s;
            day = i;
        }
    }
    printf("%d",day);
    return 0;
}